/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Giovanni
 */
@Entity
@Table(name = "weathernotification")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Weathernotification.findAll", query = "SELECT w FROM Weathernotification w"),
    @NamedQuery(name = "Weathernotification.findById", query = "SELECT w FROM Weathernotification w WHERE w.id = :id"),
    @NamedQuery(name = "Weathernotification.findByTemperature", query = "SELECT w FROM Weathernotification w WHERE w.temperature = :temperature"),
    @NamedQuery(name = "Weathernotification.findByCondition", query = "SELECT w FROM Weathernotification w WHERE w.condition = :condition"),
    @NamedQuery(name = "Weathernotification.findByCity", query = "SELECT w FROM Weathernotification w WHERE w.city = :city")})
public class Weathernotification implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TEMPERATURE")
    private int temperature;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "CONDITION")
    private String condition;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "CITY")
    private String city;
    @ManyToMany(mappedBy = "weathernotificationCollection")
    private Collection<User> userCollection;

    public Weathernotification() {
    }

    public Weathernotification(Integer id) {
        this.id = id;
    }

    public Weathernotification(Integer id, int temperature, String condition, String city) {
        this.id = id;
        this.temperature = temperature;
        this.condition = condition;
        this.city = city;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getTemperature() {
        return temperature;
    }

    public void setTemperature(int temperature) {
        this.temperature = temperature;
    }

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @XmlTransient
    public Collection<User> getUserCollection() {
        return userCollection;
    }

    public void setUserCollection(Collection<User> userCollection) {
        this.userCollection = userCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Weathernotification)) {
            return false;
        }
        Weathernotification other = (Weathernotification) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.Weathernotification[ id=" + id + " ]";
    }
    
}
